﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>行内编辑演示...</title>
    <script src="/Style/JS/Aries.Loader.js"></script>
    <script type="text/javascript">
        $(function () {
            var dg = new AR.DataGrid('Demo_TestA');
            dg.isEditor = true;
            dg.options = {
                onClickRow: function (index, row) {
                    //alert("onClickRow-" + index + ":" + JSON.stringify(row));
                },
                onBeforeEdit: function (index, row) {
                    
                },
                onEditing: function (index, row) {
                    
                    AR.Window.showMsg("onEditing-" + index + ":" + JSON.stringify(row));
                    //行内编辑时，修改某单元格的值，引发另一个单元格的值的变化。
                    var jqCellF3 = dg.datagrid("getEditor", { index: index, field: 'f3' }).target;
                    jqCellF3.keyup(function () {
                        var jqCellF1 = dg.datagrid("getEditor", { index: index, field: 'f1' }).target;
                        jqCellF1.val(jqCellF3.val());
                    });

                },
                onLoadSuccess: function () {
                    // alert(dg.PKColumn.Items.length + ":33");
                },
                onAfterEdit:function(index, row, changes)
                {
                    //alert("onAfterEdit-" + index + ":" + JSON.stringify(row));
                    //alert(changes);
                }
            }
            dg.bind();

            dg.PKColumn.Editor.BtnDel.onBeforeExecute = function (v) {
                alert("onBeforeExecute:"+v);
                // return false;
            }
            dg.ToolBar.BtnDelBatch.onBeforeExecute = function (v) {
                alert("onBeforeExecute:" + v);
            }
        });
        function fnEditor(r) {
            return {
                type: 'combobox',
                options: {
                    valueField: 'v',
                    textField: 't',
                    data: [{ v: 1, t: 'A' }, { v: 2, t: 'B' }]
                }
            };
        }
    </script>
</head>
<body>
        <div id="dg"></div>
</body>
</html>
